package com.example.demo.rest.ecom;

import com.example.demo.api.ecom.AccountApi;
import com.example.demo.bean.vo.PayMentNewVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
public class AccountController {
    @Autowired
    AccountApi accountApi;

    @GetMapping("paymentAll")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "user", value = "email账户", paramType = "query", defaultValue = "978880162@qq.com",example = "asdsadddddddddddddd"),
            @ApiImplicitParam(name = "authType", value = "身份验证类型", paramType = "query", defaultValue = "LENOVOID"),
            @ApiImplicitParam(name = "language", value = "语言", paramType = "query", defaultValue = "en")}
    )
    public Object paymentAll(@RequestParam("user") String user, @RequestParam("authType") String authType, @RequestParam("language") String language) {
        return accountApi.paymentAll(user, authType, language);
    }

    @PatchMapping("patchPayment")
    public Object patchPayment(@RequestBody PayMentNewVO payMentNewVO) {
        return accountApi.patchPayment(payMentNewVO);
    }

    @DeleteMapping("deletePayment")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "itemId", value = "itemId", paramType = "query", defaultValue = ""),
            @ApiImplicitParam(name = "user", value = "email账户", paramType = "query", defaultValue = "978880162@qq.com"),
            @ApiImplicitParam(name = "authType", value = "身份验证类型", paramType = "query", defaultValue = "LENOVOID")}
    )
    public Object deletePayment(@RequestParam("itemId") String itemId, @RequestParam("user") String user, @RequestParam("authType") String authType) {
        return accountApi.deletePayment(itemId, user, authType);
    }

    @GetMapping("getSubscription")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "user", value = "email账户", paramType = "query", defaultValue = "978880162@qq.com"),
            @ApiImplicitParam(name = "authType", value = "身份验证类型", paramType = "query", defaultValue = "LENOVOID"),
            @ApiImplicitParam(name = "language", value = "语言", paramType = "query", defaultValue = "en")}
    )
    public Object getSubscription(@RequestParam("user") String user, @RequestParam("authType") String authType, @RequestParam("language") String language) {
        return accountApi.getSubscription(user, authType, language);
    }

}
